package com.ruoyi.project.monitor.redismonitor.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.monitor.redismonitor.domain.RedisMonitor;
import com.ruoyi.project.monitor.redismonitor.mapper.RedisMonitorMapper;
import com.ruoyi.project.monitor.redismonitor.service.IRedisMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Redis监控Service业务层处理
 *
 * @author shixiangwen
 * @date 2020-04-09
 */
@Service
public class RedisMonitorServiceImpl implements IRedisMonitorService {
    @Autowired
    private RedisMonitorMapper redisMonitorMapper;

    /**
     * 查询Redis监控
     *
     * @param id Redis监控ID
     * @return Redis监控
     */
    @Override
    public RedisMonitor selectRedisMonitorById(Long id) {
        return redisMonitorMapper.selectRedisMonitorById(id);
    }

    /**
     * 查询Redis监控列表
     *
     * @param redisMonitor Redis监控
     * @return Redis监控
     */
    @Override
    public List<RedisMonitor> selectRedisMonitorList(RedisMonitor redisMonitor) {
        return redisMonitorMapper.selectRedisMonitorList(redisMonitor);
    }

    /**
     * 新增Redis监控
     *
     * @param redisMonitor Redis监控
     * @return 结果
     */
    @Override
    public int insertRedisMonitor(RedisMonitor redisMonitor) {
        return redisMonitorMapper.insertRedisMonitor(redisMonitor);
    }

    /**
     * 修改Redis监控
     *
     * @param redisMonitor Redis监控
     * @return 结果
     */
    @Override
    public int updateRedisMonitor(RedisMonitor redisMonitor) {
        return redisMonitorMapper.updateRedisMonitor(redisMonitor);
    }

    /**
     * 删除Redis监控对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteRedisMonitorByIds(String ids) {
        return redisMonitorMapper.deleteRedisMonitorByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除Redis监控信息
     *
     * @param id Redis监控ID
     * @return 结果
     */
    @Override
    public int deleteRedisMonitorById(Long id) {
        return redisMonitorMapper.deleteRedisMonitorById(id);
    }
}
